home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / DBL Pascal Library / SFGetFolder 6 ƒ / SFGetFolder.p < prev   
Text File  |  1993-06-27  |  836b  |  42 lines

  1. unit SFGetFolder;
  2.  
  3. interface
  4.  
  5.     function SFGetFolder (where: Point; var dirID: Longint): Boolean;
  6.  
  7.     const
  8.         getFolderDlgID = -4001;
  9.  
  10. implementation
  11.  
  12.     function FileFilter (pb: ParmBlkPtr): Boolean;
  13.     begin
  14.         FileFilter := True;    {never show any file}
  15.     end;
  16.  
  17.     function DialogHook (item: Integer; dlg: DialogPtr): Integer;
  18.         const
  19.             folderButton = 9;    {replaces the horizontal divider}
  20.     begin
  21.         case item of
  22.             folderButton: 
  23.                 DialogHook := getOpen;    {terminate the dialog}
  24.             otherwise
  25.                 DialogHook := item;
  26.         end;
  27.     end;
  28.  
  29.     function SFGetFolder (where: Point; var dirID: Longint): Boolean;
  30.         var
  31.             typeList: SFTypeList;
  32.             reply: SFReply;
  33.     begin
  34.         SFPGetFile(where, '', @FileFilter, -1, typeList, @DialogHook, reply, getFolderDlgID, nil);
  35.         with reply do
  36.             begin
  37.                 SFGetFolder := good;
  38.                 dirID := Longint(fType);
  39.             end;
  40.     end;
  41.  
  42. end.